#include "stdafx.h"
#include "GenericReadingInformationStub.h"
#include <string>
#include <list>
#include <set>
//#include <cmath>
#include <math.h>
#include "Reading.h"


namespace Sensor {

	std::list<std::unique_ptr<IReading>> GenericReadingInformationStub::getReading(const int sensorId, const string readingType, const ITime& start, const ITime& end) const {
		std::list<std::unique_ptr<IReading>> readings;
		if (readingType == "Parent ID") {

		} else {
			//int diff = start.getHour() - end.getHour()

			double amplitude = 20; // Peak amplitude
			double period = 3.14159265358979323846;
			int readingNumber = 10;
			for (int i=0; i<readingNumber; i++) {
				double value = std::sin(i * period)*amplitude + amplitude;

				unique_ptr<IReading> reading(new Reading(42, nullptr, readingType, value));

				readings.push_back(reading);
			}
		}

		return readings;
	}

	std::set<std::string> GenericReadingInformationStub::getReadingTypes() const {
		set<std::string> readingTypes;
		readingTypes.insert("Parent ID");
		readingTypes.insert("Temperature");
		readingTypes.insert("Moisture");
		readingTypes.insert("Battery");
		readingTypes.insert("Voltage");
		return readingTypes;
	}

	//std::set<int> GenericReadingInformationStub::getSensorIds(const ITime& start, const ITime& end) {}

}